#ifndef MEM_POOL_H
#define MEM_POOL_H

#include <cstddef>  // for size_t
#include <cstdint>  // for standard integer types
#include <array>

/* Define the size of memory blocks and memory pool capacity */
// #define INNO_MEM_POOL_SIZE 1024
// #define INNO_MEM_BLOCK_SIZE 32

namespace Fake {
extern "C" {
static const uint32_t INNO_MEM_POOL_SIZE{1024};
static const uint32_t MEM_BLOCK_SIZE{32};

struct InnoMemBlock {
  InnoMemBlock* next_block;
};

struct InnoMemPool {
  std::array<uint8_t, INNO_MEM_POOL_SIZE> mem_pool;
  InnoMemBlock* free_block_list;
};

/* Initialize the memory pool */
void mem_pool_init(InnoMemPool* m_pool);

/* Allocate memory from the memory pool */
uint8_t* mem_pool_alloc(InnoMemPool* m_pool);

/* Free memory to the memory pool */
void mem_pool_free(InnoMemPool* m_pool, uint8_t* free_ptr);
}
}  // namespace Fake

#endif  // MEM_POOL_H
